/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */

package com.haulmont.asu.entity;

import com.haulmont.chile.core.annotations.MetaProperty;
import com.haulmont.chile.core.annotations.NamePattern;
import com.haulmont.cuba.core.entity.StandardEntity;

import javax.persistence.*;

/**
 * Author: Sergey42
 * Date: 30.11.13 12:41
 */
@Table(name = "EXT_DIPLOMA_STUDENT")
@Entity(name = "ext$DiplomaStudent")
@NamePattern("%s|name")
public class DiplomaStudent extends StandardEntity {

    private static final long serialVersionUID = -5221557285147271553L;

    @ManyToOne
    @JoinColumn(name = "STUDENT_ID")
    protected Student student;

    @OneToOne(mappedBy = "diplomaStudent", cascade = CascadeType.ALL)
    protected DiplomaProject diplomaProject;

    @ManyToOne
    @JoinColumn(name = "REVIEWER_ID")
    protected Reviewer reviewer;

    @Column(name = "PRE_DEFENSE_PASSED")
    protected Boolean preDefensePassed = Boolean.FALSE;

    @Column(name = "NORM_CONTROL_PASSED")
    protected Boolean normControlPassed = Boolean.FALSE;

    @Column(name = "REVIEWER_MARK")
    protected Integer reviewerMark;

    @Column(name = "LEADER_MARK")
    protected Integer leaderMark;

    @MetaProperty
    public String getName() {
        return student != null ? student.getName() : "";
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public DiplomaProject getDiplomaProject() {
        return diplomaProject;
    }

    public void setDiplomaProject(DiplomaProject diplomaProject) {
        this.diplomaProject = diplomaProject;
    }

    public Reviewer getReviewer() {
        return reviewer;
    }

    public void setReviewer(Reviewer reviewer) {
        this.reviewer = reviewer;
    }

    public Boolean getPreDefensePassed() {
        return preDefensePassed;
    }

    public void setPreDefensePassed(Boolean preDefensePassed) {
        this.preDefensePassed = preDefensePassed;
    }

    public Boolean getNormControlPassed() {
        return normControlPassed;
    }

    public void setNormControlPassed(Boolean normControlPassed) {
        this.normControlPassed = normControlPassed;
    }

    public Integer getReviewerMark() {
        return reviewerMark;
    }

    public void setReviewerMark(Integer reviewerMark) {
        this.reviewerMark = reviewerMark;
    }

    public Integer getLeaderMark() {
        return leaderMark;
    }

    public void setLeaderMark(Integer leaderMark) {
        this.leaderMark = leaderMark;
    }
}
